package com.dong.security;

import com.dong.service.AuthService;
import org.aopalliance.intercept.Joinpoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class SecurityAspect {
    @Autowired
    private AuthService authService;
    @Pointcut("@annotation(AdminOnly)")
    private void pointCut(){

    }
    @Before("@annotation(AdminOnly))")
    public void check() {
        authService.checkAccess();
    }
}
